<html>
<head><meta charset="utf-8"><title>merge `Operand::Move` and `::Copy` · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html">merge `Operand::Move` and `::Copy`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165901100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165901100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165901100">(May 17 2019 at 13:41)</a>:</h4>
<p>These are used identically almost everywhere. There's just a few places that actually care. I think it may be simpler to just have a single variant <code>Use</code> which has both a <code>Place</code> and a <code>enum UseKind { Move, Copy }</code>. Not sure if that's too dangerous for the cases that care, but the cases that don't would become so much more readable</p>



<a name="165949107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165949107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165949107">(May 18 2019 at 00:57)</a>:</h4>
<p>I guess I could work on this, I'm around that code often :)</p>



<a name="165949159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165949159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165949159">(May 18 2019 at 00:58)</a>:</h4>
<p>at the same time, happy to give the opportunity to somebody else and even to help them if needed</p>



<a name="165950582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165950582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165950582">(May 18 2019 at 01:34)</a>:</h4>
<p>Would it make the object bigger?  Or would it just get packed into existing padding next to the discriminant?</p>
<p>Conceptually it's probably fine, though, and I don't see any discussion of the form in <a href="https://github.com/rust-lang/rust/pull/46142" target="_blank" title="https://github.com/rust-lang/rust/pull/46142">https://github.com/rust-lang/rust/pull/46142</a></p>



<a name="165964318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165964318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165964318">(May 18 2019 at 08:02)</a>:</h4>
<p>Some experiments show that the size does not change: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=1fdf34a3e291172a50564b061ba2131a" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=1fdf34a3e291172a50564b061ba2131a">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=1fdf34a3e291172a50564b061ba2131a</a></p>



<a name="165964320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/165964320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#165964320">(May 18 2019 at 08:02)</a>:</h4>
<p>although there's general room for improvement</p>



<a name="171506618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/171506618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Saleem Jaffer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#171506618">(Jul 23 2019 at 10:34)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I can take this up :)</p>



<a name="171515714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/171515714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#171515714">(Jul 23 2019 at 13:03)</a>:</h4>
<p>Uh, talk to <span class="user-mention" data-user-id="119009">@eddyb</span> first they split up Operand::Consume to begin with</p>



<a name="171941176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/171941176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Saleem Jaffer <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#171941176">(Jul 29 2019 at 12:32)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Can I pick this up?</p>



<a name="172004123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/172004123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#172004123">(Jul 30 2019 at 04:22)</a>:</h4>
<p>I did it for <span class="user-mention" data-user-id="116009">@nikomatsakis</span>, because the MIR borrowck wanted to know that distinction</p>



<a name="172004129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/172004129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#172004129">(Jul 30 2019 at 04:22)</a>:</h4>
<p>I don't have a strong preference as long as the infrmation is still there</p>



<a name="172004130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/merge%20%60Operand%3A%3AMove%60%20and%20%60%3A%3ACopy%60/near/172004130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/merge.20.60Operand.3A.3AMove.60.20and.20.60.3A.3ACopy.60.html#172004130">(Jul 30 2019 at 04:22)</a>:</h4>
<p>but do talk to niko</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>